import { request } from '@/api/service'
import qs from 'qs'

//
//

// ----------公共部分
// 登录
export function Login (data) {
  return request({
    method: 'post',
    url: '/auth/login/',
    data: qs.stringify(data)
  })
}

// 登录时，获取用户信息
export function getUserInfo (params) {
  return request({
    url: '/auth/getUserInfo/',
    params: params
  })
}

// 登陆时，根据用户id，获取是否有专家信息
export function getExportInfo (params) {
  return request({
    url: '/setup/expert/',
    params: params
  })
}

// 获取班级列表
export function getOrganization () {
  return request({
    url: 'career/organization'
  })
}

// 获取专家列表
export function getExperts () {
  return request({
    url: 'career/experts'
  })
}

// 获取时段列表
export function getTimesLotList () {
  return request({
    url: 'career/timeslot'
  })
}

//
//

// ----------职业规划

// 提交职业规划
export function publishCareerPlan (data) {
  return request({
    method: 'post',
    url: 'career/publishCareerPlan/',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    // { indices: false }作用是去除请求体中的下标
    data: qs.stringify(data, { indices: false })
  })
}

// 保存职业规划
export function saveCareerPlan (data) {
  return request({
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    url: 'career/saveCareerPlan/',
    data: qs.stringify(data, { indices: false })
  })
}

// 更新职业规划
export function modifyCareerPlan (data) {
  return request({
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    url: 'career/modifyCareerPlan/',
    data: qs.stringify(data, { indices: false })
  })
}

// 删除职业规划
export function deleteCareerPlan (params) {
  return request({
    url: 'career/deletedCareerPlan/',
    params: params
  })
}

// 根据id获取职业规划详情
export function getCareerPlan (params) {
  return request({
    url: 'career/getCareerPlan/',
    params: params
  })
}

// 获取职业规划列表
export function getCareerPlanList (params) {
  return request({
    url: 'career/manage/',
    params: params
  })
}

// 获取评论列表
export function getCareerCommentList (params) {
  return request({
    url: 'career/careerComments/',
    params: params
  })
}

//
//

// ----------简历部分
export function getApplyjobList (params) {
  return request({
    url: 'job/getAppllyjobList/',
    params: params
  })
}
// 保存求职记录
export function saveApplyjob (data) {
  return request({
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    url: 'job/saveApplyjob/',
    data: qs.stringify(data, { indices: false })
  })
}

export function getQiniuToken () {
  return request({
    url: '/resume/qiniutoken/'
  })
}

export function addResume (data) {
  return request({
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    url: 'resume/addResume/',
    data: qs.stringify(data)
  })
}

export function deleteResume (params) {
  return request({
    url: '/resume/deleteResume/',
    params: params
  })
}

export function sendMessage (data) {
  return request({
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    url: '/resume/addMessage/',
    data: qs.stringify(data)
  })
}

export function getResumeList (params) {
  return request({
    url: '/resume/getResumeList/',
    params: params
  })
}

export function getResumeComents (params) {
  return request({
    url: '/resume/getResumeComments/',
    params: params
  })
}

export function deleteComments (params) {
  return request({
    url: '/resume/deleteComment/',
    params: params
  })
}
//
//

// ----------统计

export function getCareerPlanEnterprise (params) {
  return request({
    url: 'statistics/CareerPlanStatistics/',
    params: params
  })
}

export function IceModelStatistics (params) {
  return request({
    url: 'statistics/IceModelStatistics/',
    params: params
  })
}
